package com.rd.student.ruanjian.class4.zhouzihe.day18;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class TestIn {
    public static void main(String[] args) {

        //逐层转化 先获取InputStream 然后获取 InputStreamReader(转换流)
        //最后再获取 BufferReader
        String line = null;
        try (InputStream is = System.in;InputStreamReader reader = new InputStreamReader(is);BufferedReader br = new BufferedReader(reader)) {
            while (true) {
                line = br.readLine();
                if (line == null) break;
                if (line.equals("exit")) {
                    System.exit(0);
                }
                System.out.println(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
